﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace KJSyncXP.Views
{
    /// <summary>
    /// CustomNotificationWindow.xaml 的交互逻辑
    /// </summary>
    public partial class CustomNotificationWindow : Window
    {
       /* // 拖动相关变量
        private bool _isDragging;       // 是否正在拖动
        private Point _startPoint;      // 鼠标按下时的位置
        private Point _windowStartPoint; // 窗口初始位置


        // 标题栏鼠标按下：开始拖动
        private void TitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            _isDragging = true;
            // 记录鼠标按下时的屏幕坐标和窗口位置
            _startPoint = e.GetPosition(this);
            _windowStartPoint = new Point(this.Left, this.Top);
            // 捕获鼠标，防止拖动时鼠标移出窗口导致拖动中断
            TitleBar.CaptureMouse();
        }

        // 标题栏鼠标移动：执行拖动
        private void TitleBar_MouseMove(object sender, MouseEventArgs e)
        {
            if (!_isDragging) return;

            // 计算鼠标偏移量
            var currentPoint = e.GetPosition(this);
            var offsetX = currentPoint.X - _startPoint.X;
            var offsetY = currentPoint.Y - _startPoint.Y;

            // 更新窗口位置
            this.Left = _windowStartPoint.X + offsetX;
            this.Top = _windowStartPoint.Y + offsetY;
        }

        // 标题栏鼠标松开：结束拖动
        private void TitleBar_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            _isDragging = false;
            // 释放鼠标捕获
            TitleBar.ReleaseMouseCapture();
        }*/


        // 标题属性：外部可设置弹窗标题
        public string NotificationTitle
        {
            get => txtTitle.Text;
            set => txtTitle.Text = value;
        }

        // 内容属性：外部可设置弹窗文本内容
        public string NotificationContent
        {
            get => txtContent.Text;
            set => txtContent.Text = value;
        }

        public CustomNotificationWindow()
        {
            InitializeComponent();
        }

        // 关闭按钮逻辑
        private void BtnClose_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        // 退出按钮逻辑
        private void BtnExit_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        // 确认按钮逻辑（可返回 DialogResult 供调用方判断）
        private void BtnConfirm_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true; // 设置确认结果
            this.Close();
        }
    }
}
